<template>
  <div class='invia'>
      <mt-header fixed title="邀请">
        <router-link to="/user" replace slot="left">
          <mt-button icon="back">返回</mt-button>
        </router-link>
      </mt-header>
    <div id="qcode">
      <canvas id="canvas"></canvas>
    </div>
  </div>
</template>

<script>
import QRCode from 'qrcode'
export default {
  data () {
    return {
      key: ''
    }
  },
  mounted () {
    this.useqrcode()
    let a = localStorage.getItem('phone')
    localStorage.setItem('codes', a)
  },
  methods: {
    useqrcode () {
      var canvas = document.getElementById('canvas')
      QRCode.toCanvas(canvas, 'http://123.207.169.200:8080/register?phone=' + localStorage.getItem('codes'), function (error) {
        if (error) console.error(error)
      })
    }
  }
}
</script>

<style scoped >
.invia{
  height: 100vh;
  background: url('../assets/img/erwei.png') no-repeat;
  background-size: 100% 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
#qcode{
  width: 1.85rem;
  height: 1.85rem;
  background-color: #fff;
}
#canvas{
  width: 100% !important;
  height: 100% !important;
}
</style>
